using UnityEngine;
using System.Collections;

public class Main : MonoBehaviour
{

	// Use this for initialization
	void Start ()
	{
		//never sleep
		Screen.sleepTimeout = SleepTimeout.NeverSleep; 
		renderer.material.color = Color.green;
	}
	
	// Update is called once per frame
	int count = 0;
	void Update ()
	{
		//return;
		int nowTime = Mathf.FloorToInt(Time.time);		
		if(nowTime/1 == count){
			count++;
			CreateCube.createRandom();
		}	
	}
	
	//
	void OnTriggerEnter(Collider obj){
		if(obj.gameObject.name != "Avatar"
			&& obj.gameObject.name != "MainTerrain"){
			Debug.Log("Collision---->"+obj.gameObject.name);
			//transform.localScale -= new Vector3(1,1,1);
			Destroy(obj.gameObject);			
		}
	}
	
	//onCollision
	/*void OnCollisionEnter(Collision obj) {
		if(obj.gameObject.name != "Avatar"
			&& obj.gameObject.name != "MainTerrain"){
			Debug.Log("Collision---->"+obj.gameObject.name);
			obj.gameObject.transform.localScale -= new Vector3(1,1,1);
			Destroy(obj.gameObject);			
		}
	}*/
}

